/* 全局样式重置 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', 'Helvetica Neue', Helvetica, Arial, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f5f7fa;
}

/* 容器样式 */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* 头部样式 */
header {
    margin-bottom: 30px;
    padding-bottom: 15px;
    border-bottom: 1px solid #e1e8ed;
}

header h1 {
    font-size: 2.5rem;
    color: #1da1f2;
    font-weight: 600;
}

/* 消息提示样式 */
.messages {
    margin-bottom: 20px;
}

.message {
    padding: 12px 20px;
    margin-bottom: 10px;
    border-radius: 8px;
    background-color: #e6f7ff;
    color: #1890ff;
    border-left: 4px solid #1890ff;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.message.fade-out {
    opacity: 0;
    transform: translateY(-10px);
}

/* 搜索和新建按钮区域 */
.search-create-section {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    flex-wrap: wrap;
    gap: 15px;
}

.search-container {
    flex: 1;
    min-width: 300px;
}

.search-form {
    display: flex;
    gap: 10px;
}

.search-input {
    flex: 1;
    padding: 12px 16px;
    border: 2px solid #d9d9d9;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.3s ease;
}

.search-input:focus {
    outline: none;
    border-color: #1da1f2;
}

.search-btn {
    padding: 12px 24px;
    background-color: #1da1f2;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.search-btn:hover {
    background-color: #0d95e8;
}

.new-note-btn {
    padding: 12px 24px;
    background-color: #28a745;
    color: white;
    text-decoration: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 500;
    transition: background-color 0.3s ease;
}

.new-note-btn:hover {
    background-color: #218838;
}

/* 笔记列表区域 */
.notes-section {
    margin-bottom: 40px;
}

.notes-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 20px;
}

.note-item {
    background-color: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.note-item:hover {
    transform: translateY(-4px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}

.note-title {
    margin-bottom: 10px;
    font-size: 1.3rem;
    font-weight: 600;
}

.note-title a {
    color: #1da1f2;
    text-decoration: none;
    transition: color 0.3s ease;
}

.note-title a:hover {
    color: #0d95e8;
    text-decoration: underline;
}

.note-preview {
    margin-bottom: 15px;
    color: #657786;
    font-size: 0.95rem;
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.note-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    font-size: 0.85rem;
    color: #aab8c2;
}

.no-notes {
    background-color: white;
    border-radius: 12px;
    padding: 40px;
    text-align: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.no-notes p {
    margin-bottom: 20px;
    font-size: 1.1rem;
    color: #657786;
}

.no-notes a {
    color: #1da1f2;
    text-decoration: none;
    font-weight: 500;
}

.no-notes a:hover {
    text-decoration: underline;
}

/* 笔记详情区域 */
.note-detail-section {
    background-color: white;
    border-radius: 12px;
    padding: 30px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.note-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 15px;
}

.note-header .note-title {
    margin-bottom: 0;
    flex: 1;
}

.note-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.edit-btn, .delete-btn, .back-btn {
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.edit-btn {
    background-color: #1da1f2;
    color: white;
}

.edit-btn:hover {
    background-color: #0d95e8;
}

.delete-btn {
    background-color: #dc3545;
    color: white;
}

.delete-btn:hover {
    background-color: #c82333;
}

.back-btn {
    background-color: #6c757d;
    color: white;
}

.back-btn:hover {
    background-color: #5a6268;
}

/* Markdown内容样式 */
.markdown-content {
    margin-top: 20px;
    line-height: 1.8;
}

.markdown-content h1, 
.markdown-content h2, 
.markdown-content h3, 
.markdown-content h4, 
.markdown-content h5, 
.markdown-content h6 {
    margin-top: 30px;
    margin-bottom: 15px;
    color: #14171a;
    font-weight: 600;
}

.markdown-content h1 {
    font-size: 2rem;
    border-bottom: 1px solid #e1e8ed;
    padding-bottom: 10px;
}

.markdown-content h2 {
    font-size: 1.75rem;
    border-bottom: 1px solid #e1e8ed;
    padding-bottom: 8px;
}

.markdown-content h3 {
    font-size: 1.5rem;
}

.markdown-content p {
    margin-bottom: 20px;
}

.markdown-content ul, 
.markdown-content ol {
    margin-bottom: 20px;
    padding-left: 25px;
}

.markdown-content li {
    margin-bottom: 8px;
}

.markdown-content strong {
    font-weight: 600;
    color: #14171a;
}

.markdown-content em {
    font-style: italic;
}

.markdown-content a {
    color: #1da1f2;
    text-decoration: none;
}

.markdown-content a:hover {
    text-decoration: underline;
}

.markdown-content blockquote {
    border-left: 4px solid #1da1f2;
    padding-left: 20px;
    margin: 20px 0;
    color: #657786;
}

.markdown-content pre {
    background-color: #f5f8fa;
    padding: 16px;
    border-radius: 8px;
    overflow-x: auto;
    margin: 20px 0;
    font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
}

.markdown-content code {
    background-color: #f5f8fa;
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
    font-size: 0.9em;
}

.markdown-content pre code {
    background-color: transparent;
    padding: 0;
}

/* 编辑笔记区域 */
.edit-section {
    background-color: white;
    border-radius: 12px;
    padding: 30px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.edit-section h2 {
    margin-bottom: 20px;
    color: #14171a;
    font-size: 1.75rem;
}

.form-group {
    margin-bottom: 25px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #14171a;
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #d9d9d9;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.3s ease;
    font-family: inherit;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #1da1f2;
}

.form-group textarea {
    resize: vertical;
    min-height: 300px;
    line-height: 1.6;
}

.form-actions {
    display: flex;
    gap: 15px;
    margin-top: 30px;
}

.save-btn, .cancel-btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.save-btn {
    background-color: #28a745;
    color: white;
}

.save-btn:hover {
    background-color: #218838;
}

.cancel-btn {
    background-color: #6c757d;
    color: white;
}

.cancel-btn:hover {
    background-color: #5a6268;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .container {
        padding: 15px;
    }
    
    header h1 {
        font-size: 2rem;
    }
    
    .search-create-section {
        flex-direction: column;
        align-items: stretch;
    }
    
    .search-container {
        min-width: auto;
    }
    
    .notes-list {
        grid-template-columns: 1fr;
    }
    
    .note-header {
        flex-direction: column;
        align-items: stretch;
    }
    
    .note-actions {
        justify-content: center;
    }
    
    .form-actions {
        flex-direction: column;
    }
    
    .form-actions button,
    .form-actions a {
        text-align: center;
    }
}